
<div class="card-view profile-card">
<% @profile_user.normal_tags.each do |tag| %>
  <div class="card shadow-sm p-2 mb-3 bg-white rounded" >
    <div class="card-header mt-2">
      <h4 style="display: inline-block;"><%= tag.name %></h3>
      <p class="posted-by-links"><a href="/tag/<%= tag.name %>"><%= pluralize(Tag.follower_count(tag.name), 'person') %> discussing</a></p>
    </div>
    <div class="card-body">
      <% Tag.find_nodes_by_type(tag.name, type = 'note', limit = 3, author_id = @profile_user.id).each do |node|  %>
        <div class="posted-by-links">
          <% if node.main_image %>
            <img class="rounded-circle" id="profile-photo" style="width:20px; height:20px; margin-right:8px; display: inline-block;" src="<%= node.main_image.path(:default) %>" />
          <% elsif node.scraped_image %>
            <img class="rounded-circle" id="profile-photo" style="width:20px; height:20px; margin-right:8px; display: inline-block;" src="<%= node.scraped_image %>" />
          <% else %>
            <div class="circle"></div>
          <% end %>
          <a class="post-title" <% if @widget %>target="_blank"<% end %> href="<%= node.path %>"><%= (node.type == 'note') ? node.title : node.latest.title %></a>
        </div>
      <% end %>
    </div>
    <div class="card-footer row align-items-center">
      <div class="col-12 col-xl-auto">
        <div class="posted-by-links">
          <a href="/tag/<%= tag.name %>/author/<%= @profile_user.name %>"><i class="fa fa-file pr-1"></i><%= translation('tag.index.notes', count: Node.find_by_tag_and_author(tag.name, @profile_user.id, 'notes').size) %></a> |
          <a href="/questions/tag/<%= tag.name %>/author/<%= @profile_user.name %>"><i class="fa fa-question-circle pr-1"></i><%= translation('tag.index.questions', count: Node.find_by_tag_and_author(tag.name, @profile_user.id, 'questions').size) %></a> |
          <a href="/profile/comments/<%= @profile_user.name %>/tag/<%= tag.name %>"><i class="fa fa-comments pr-1"></i><%= translation('tag.index.comments', count: Comment.find_by_tag_and_author(tag.name, @profile_user.id).size) %></a>
          by @<%= @profile_user.name %>
        </div>
      </div>
    </div>
    
    <div class="mb-2 mr-2">
      <a style="float: right;  width: 100px;" rel="tooltip" title="<%= translation('sidebar._post_button.share_your_work',{},false) %>" data-placement="bottom" href="/post?tags=<%= tag.name %>" class="btn btn-primary btn-sm"><%= translation('tag.show.new_post') %> <i class="fa fa-plus fa-white"></i></a>
      <% if current_user %>
        <div id="follow-unfollow-column-<%=tag.tid%>" style="float: right; margin-right: 10px;">
          <% if current_user.following(tag.name) %>
            <a style="width: 100px;" rel="tooltip" title="<%= translation('tag.show.unfollow',{},false) %>" class="btn btn-light btn-sm active" href="/unsubscribe/tag/<%= tag.name %>" data-method="delete"> <%= translation('tag.index.unfollow') %></a>
          <% else %>
            <a style="width: 100px;" class="btn btn-outline-secondary btn-sm index-follow-buttons follow-btn-remote" href="/subscribe/tag/<%= tag.name %>" data-remote="true"><%= translation('tag.index.follow') %></a>
          <% end %>
        </div>
      <% end %>
    </div>
  </div>
<% end %>
</div>
